package com.levi.juc.function_interface;

import java.util.function.Consumer;

/**
 * 消费型接口
 * 只有输入参数，没有返回值
 */
public class ConsumerTest {
    public static void main(String[] args) {
//        Consumer<String> consumer = new Consumer<String>() {
//            @Override
//            public void accept(String str) {
//                System.out.println(str);
//            }
//        };
        //lambda表达式
        Consumer<String> consumer = System.out::println;
        consumer.accept("levi");

        Consumer<String> cc = (str) -> System.out.println(str + " world");
        cc.accept("hello");
    }
}
